package com.base.cn.platform.os.service.manage.op.giftcard;

import com.base.cn.platform.os.service.FeignAuthConfig;
import com.base.cn.platform.os.service.manage.BaseService;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 礼品卡编码接口
 */
@FeignClient(name = BaseService.appName , configuration = FeignAuthConfig.class)
public interface OpGiftCardCodeService extends BaseService {


    /**
     * 搜索礼品卡编码券
     * @param currentPage
     * @param opGiftCardCode
     * @return
     */
    @RequestMapping(contextPath + "/op/queryOpGiftCardCodeListPage")
    Map<String,Object> queryOpGiftCardCodeListPage(@RequestParam("currentPage") Integer currentPage,
                                                   @RequestBody Map<String, Object> opGiftCardCode,
                                                   @RequestParam("giftCardData") boolean giftCardData,
                                                   @RequestParam("userData") boolean userData,
                                                   @RequestParam("courseData") boolean courseData);

    /**
     * 搜索礼品卡编码券
     * @param opGiftCardCode
     * @return
     */
    @RequestMapping(contextPath + "/op/queryOpGiftCardCodeList")
    List<Map<String,Object>> queryOpGiftCardCodeList(@RequestBody Map<String, Object> opGiftCardCode,
                                                     @RequestParam(value = "giftCardData", required = false, defaultValue = "false") boolean giftCardData,
                                                     @RequestParam(value = "userData", required = false, defaultValue = "false") boolean userData,
                                                     @RequestParam(value = "courseData", required = false, defaultValue = "false") boolean courseData);

    /**
     * 根据卡号和类型搜索礼品卡
     * @param code
     * @param type
     * @return
     */
    @RequestMapping(contextPath + "/op/queryGiftCardCodeByCode")
    Map<String,Object> queryGiftCardCodeByCode(@RequestParam("code") String code,
                                               @RequestParam("type") Integer type);

    /**
     * 修改使用状态
     * @param userCardId == id
     * @param status
     * @param userId
     * @return
     */
    @RequestMapping(contextPath + "/op/updateGiftCardStatusCode")
    void updateGiftCardStatusCode(@RequestParam("userCardId") BigDecimal userCardId,
                                  @RequestParam("status") Integer status,
                                  @RequestParam("userId") BigDecimal userId);

    /**
     * 激活礼卡
     * @param id 礼卡ID
     * @param userId 用户ID
     * @param code 礼卡编码
     * @param codePwd 礼卡密码
     * @return Map<String,Object>
     */
    @RequestMapping(contextPath + "/op/activateGiftCard")
    Map<String,Object> activateGiftCard(@RequestParam(value = "id", defaultValue = "0", required = false) BigDecimal id,
                                        @RequestParam("userId") BigDecimal userId,
                                        @RequestParam(value = "code", required = false) String code,
                                        @RequestParam(value = "codePwd", required = false) String codePwd);


}
